import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 合同档案-变压器信息 */
export interface ContractArchiveTransformer {
  id: number // id
  contractArchiveId: number // 合同档案id
  volume: number // 变压器容量(kVA)
  amount: number // 数量(台)
}

// 合同档案-变压器 API
export const ContractArchiveTransformerApi = {
  // 查询合同档案-变压器分页
  getContractArchiveTransformerPage: async (params: any) => {
    return await request.get({ url: `/san/biz-contract-archive-transformer/page`, params })
  },

  // 查询合同档案-变压器详情
  getContractArchiveTransformer: async (id: number) => {
    return await request.get({ url: `/san/biz-contract-archive-transformer/get?id=` + id })
  },

  // 新增合同档案-变压器
  createContractArchiveTransformer: async (data: ContractArchiveTransformer) => {
    return await request.post({ url: `/san/biz-contract-archive-transformer/create`, data })
  },

  // 修改合同档案-变压器
  updateContractArchiveTransformer: async (data: ContractArchiveTransformer) => {
    return await request.put({ url: `/san/biz-contract-archive-transformer/update`, data })
  },

  // 删除合同档案-变压器
  deleteContractArchiveTransformer: async (id: number) => {
    return await request.delete({ url: `/san/biz-contract-archive-transformer/delete?id=` + id })
  },

  /** 批量删除合同档案-变压器 */
  deleteContractArchiveTransformerList: async (ids: number[]) => {
    return await request.delete({
      url: `/san/biz-contract-archive-transformer/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出合同档案-变压器 Excel
  exportContractArchiveTransformer: async (params) => {
    return await request.download({
      url: `/san/biz-contract-archive-transformer/export-excel`,
      params
    })
  }
}
